package com.aaa.controller;

import com.aaa.service.StaffService;
import com.aaa.vo.LoginVo;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: keyboard
 * @description:
 * @author: 闫克起2
 * @create: 2024-03-15 15:04
 **/
@RestController
public class LoginController {
    @Autowired
    private StaffService staffService;
    @PostMapping("/login")
    public Result login(@RequestBody LoginVo loginVo){
        if(StringUtils.isEmpty(loginVo.getUsername())||StringUtils.isEmpty(loginVo.getPassword())){
            return new Result(500,"账户密码为空",null);
        }
        Result result = staffService.findByNameAndPwd(loginVo.getUsername(), loginVo.getPassword());
        return result;
    }
}




